local skel = fk.CreateSkill {
  name = "emo__zhujiao",
}

skel:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Draw
    and not data.phase_end and player.hp > 0
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    return player.room:askToSkillInvoke(player, {skill_name = skel.name, prompt = "#emo__zhujiao-invoke:::"..player.hp })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    data.phase_end = true
    local choice = room:askToChoice(player, { choices = {"basic", "trick", "equip" }, skill_name = skel.name })
    local ids = room:getCardsFromPileByRule(".|.|.|.|.|" ..choice, player.hp, "drawPile" )
    if #ids > 0 then
      room:obtainCard(player, ids, true, fk.ReasonJustMove, player, skel.name)
    end
  end,
})

Fk:loadTranslationTable{
  ["emo__zhujiao"] = "主教",
  [":emo__zhujiao"] = "你可以放弃摸牌，选择一种牌的类型，并从牌堆中X张此类型的牌（X为你当前体力值）。",

  ["#emo__zhujiao-invoke"] = "主教：你可以放弃摸牌，获得 %arg 张指定类型的牌",
}

return skel
